<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品订单列表</title>
    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css" media="all">
    <style>
        .orderList-container {
            padding: 20px;
        }

        td[data-field="imgUrl"] div,
        td[data-field="negativeImgUrl"] div {
            height: 120px;
        }

        .lay-form {
            padding: 20px;
        }

        .orderList-container {
            background-color: #fff;
        }

        .bar {
            display: flex;
            justify-content: flex-start;
            align-items: flex-end;
        }

        .searchInput {
            display: flex;
            align-items: flex-end;
        }

        .searchInput label {
            font-size: 12px;
        }

        .searchInput input {
            width: 200px;
        }

        .searchInput .layui-form-label {
            padding: 9px 0;
        }

        .bar .layui-form-label {
            padding: 0;
            padding-bottom: 4px;
            text-align: left;
        }

        .bar .layui-inline {
            margin-right: 20px;
        }

        .layui-table img {
            max-width: 200px;
            object-fit: contain;
        }

        .layui-table-cell {
            height: auto;
        }

        .layer-container {
            padding: 20px;
        }

        .layer-container ul {
            display: flex;
        }

        .layer-container ul li {
            border: 1px solid #efefef;
            flex: 1;
            padding: 30px;
            text-align: center;
        }

        .layer-container ul li p {
            line-height: 30px;
            color: #666;
        }

        .layer-container ul .flag {
            flex: 0 0 300px;
        }
    </style>
</head>

<body>
    <div class="orderList-container">
        <!-- 搜索 -->
        <div class="searchInput">
            <form class="layui-form" action="" lay-filter="resets">
                <div class="layui-inline">
                    <label class="layui-form-label">订单编号：</label>
                    <input class="layui-input" name="ordersNo" placeholder="请输入订单编号" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">下单日期：</label>
                    <input type="text" class="layui-input" id="test1" name="sDate" placeholder="请输入下单日期"
                        autocomplete="off">
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">收货人姓名：</label>
                    <input class="layui-input" name="receiverName" placeholder="请输入收货人姓名" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">收货人手机：</label>
                    <input class="layui-input" name="receiverMobile" placeholder="请输入收货人手机" autocomplete="off">
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">商品名称：</label>
                    <input class="layui-input" name="goodsName" placeholder="请输入商品名称" autocomplete="off">
                </div>
                <button class="layui-btn" data-type="reload" lay-submit="" lay-filter="searchForm">搜索</button>
                <button class="layui-btn layui-btn-primary" data-type="reload" lay-submit=""
                    lay-filter="reset">重置</button>
            </form>
        </div>

        <form class="layui-form">
            <!-- 筛选 -->
            <div class="layui-inline" id="status" style="margin-top: 20px">
                <label class="layui-form-label"
                    style="padding-left:10px; text-align:center; padding-right:0 ; width: 60px;">状态：</label>
                <div class="layui-input-block" style="margin-left: 80px;">
                    <select name="stop" lay-filter="select">
                        <option value="">全部</option>
                        <option value="20000">待付款</option>
                        <option value="20001">待发货</option>
                        <option value="20002">已发货</option>
                        <option value="20003">已完成</option>
                        <option value="20004">已关闭</option>
                        <option value="20005">待退款</option>
                        <option value="20007">待退货</option>
                        <option value="20006">已退款</option>
                        <option value="20008">已退货</option>
                    </select>
                </div>
            </div>
            <!-- <button class="layui-btn" style="margin-top: 20px; margin-left: 20px;" id="downLoad">导出全部订单</button> -->
        </form>

        <table lay-filter="orderListTable" class="layui-hide" id="orderListTable"></table>
    </div>

</body>


<!-- 操作 -->
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="lookDetails">查看详情</a>
</script>
<link rel="stylesheet" href="../../common/css/steps.min.css">
<script src="https://cdn.bootcdn.net/ajax/libs/layui/2.5.7/layui.all.min.js"></script>
<script src="../utils.js"></script>
<script src="../../common/js/steps.min.js"></script>
<script>

    Date.prototype.format = function (fmt) {
        var o = {
            "M+": this.getMonth() + 1,
            "d+": this.getDate(),
            "h+": this.getHours(),
            "m+": this.getMinutes(),
            "s+": this.getSeconds(),
            "q+": Math.floor((this.getMonth() + 3) / 3),
            "S": this.getMilliseconds()
        };
        if (/(y+)/.test(fmt)) {
            fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        }
        for (var k in o) {
            if (new RegExp("(" + k + ")").test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            }
        }
        return fmt;
    };



    layui.use(['table', 'upload', 'form', 'jquery', "laydate"], function () {
        var table = layui.table,
            upload = layui.upload,
            form = layui.form,
            laydate = layui.laydate,
            $ = layui.jquery;


        // $('#downLoad').on("click", function(e){
        //     e.preventDefault();

        //     ajax({
        //         path: "/order/export",
        //         type:"get",
        //         success: function (res) {
        //             console.log(res);
        //         }
        //     }, $)

        // })

        table.render({
            elem: '#orderListTable'
            , toolbar: "#toolbarDemo"
            , url: window.baseUrl + '/order/getOrder'
            , headers: {
                Authorization: localStorage.token
            }
            , response: {
                statusCode: 200 //规定成功的状态码，默认：0
            }
            , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            , parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": 200,
                    "count": res.data.recordsTotal, //解析数据长度
                    "data": res.data.data //解析数据列表
                };
            }
            , request: {
                pageName: 'start' //页码的参数名称，默认：page
                , limitName: 'length' //每页数据量的参数名，默认：limit
            }
            , cols: [[
                { field: 'ordersId', width: 80, title: '订单ID' }
                , { field: 'ordersNo', width: 170, title: '订单编号' }
                , { field: 'createTime', width: 170, title: '下单时间' }
                , {
                    field: 'fullName', title: '商品', templet: function (res) {
                        let a = "";
                        for (let i = 0; i < res.orderDetailList.length; i++) {
                            const el = res.orderDetailList[i];
                            a += `
                            <div style="display:flex; align-items:center; border: 1px solid #eee; padding: 10px; 0">
                                <div class="imgCover">
                                    <img style="width:100px; height:100px;object-fit: contain;" src="${el.skuCoversUrl}"/>
                                </div>
                                <div style="margin-left: 10px;"> 
                                    <p>名称：${el.goodsName || "商品失效或已删除"}</p>
                                    <p>价格：￥${el.skuCurrPrice || 0}元</p>
                                    <p>数量：${el.quantity}</p>
                                </div>
                            </div>
                        `
                        }

                        return a;

                    }
                }
                , {
                    field: 'receiverDistrict', title: '地址', templet: function (res) {
                        return `
                        <div>
                            <p>${res.receiverName}</p>
                            <p>${res.receiverMobile}</p>
                            <p>${res.receiverDistrict}${res.receiverAddress}</p>
                        </div>
                    `
                    }
                }
                , {
                    field: 'ordersLogisticsList', title: '物流信息', templet: function (res) {
                        if (res.ordersLogisticsList.length) {
                            for (let i = 0; i < res.ordersLogisticsList.length; i++) {
                                const el = res.ordersLogisticsList[i];
                                if (el.type == 1) {
                                    return `
                                        <p>物流公司：${el.logisticsName || '-'}</p>
                                        <p>物流单号：${el.deliveryOrdersNo || '-'}</p>
                                    `
                                } else {
                                    return "-"
                                }
                            }
                        } else {
                            return "-"
                        }
                        
                        
                    }
                }
                , {
                    field: 'payWay', title: '付款方式', width: 100, templet: function (res) {
                        switch (res.payWay) {
                            case 1:
                                return "微信支付";
                            case 2:
                                return "积分支付";
                            case 3:
                                return "扫码支付";
                            case 4:
                                return "混合支付";
                            default:
                                return "-"
                        }
                    }
                }
                , {
                    field: 'ordersState', title: '订单状态', width: 100, templet: function (res) {
                        switch (res.ordersState) {
                            case "20000":
                                return "未付款";
                            case "20001":
                                return "已付款";
                            case "20002":
                                return "已发货";
                            case "20003":
                                return "交易成功";
                            case "20004":
                                return "交易关闭";
                            case "20007":
                                return "申请退货";
                            case "20005":
                                return "申请退款";
                            case "20006":
                                return "退款成功";
                            case "20008":
                                return "退货成功";
                        }
                    }
                }
                , {
                    title: '操作', width: 100, templet: function (res) {
                        res.orderDetailList = [];
                        switch (res.ordersState) {
                            case "20000":
                                return `<button type="button" class="layui-btn layui-btn-xs closeOrder" data-item='${JSON.stringify(res)}'>关闭订单</button>`;
                            case "20001":
                                return `
                                    <button type="button" class="layui-btn layui-btn-xs postExpress" data-item='${JSON.stringify(res)}'>发货</button>
                                `;
                            case "20007":
                                return `
                                    <div>
                                        <p>
                                            <button type="button" class="layui-btn layui-btn-xs okTT" data-item='${JSON.stringify(res)}'>同意退货</button>
                                        </p>
                                        <!-- <button type="button" class="layui-btn layui-btn-xs layui-btn-danger">拒绝退货</button> -->
                                    </div>
                                `;
                            case "20005":
                                return `
                                <div>
                                    <p>
                                        <button type="button" class="layui-btn layui-btn-xs okTk" data-item='${JSON.stringify(res)}'>同意退款</button>
                                    </p>
                                    <!-- <button type="button" class="layui-btn layui-btn-xs layui-btn-danger">拒绝退款</button> -->
                                </div>
                            `;
                            default:
                                return "-"
                        }
                    }
                }
                , { title: '查看详情', width: 90, toolbar: '#barDemo' }
            ]],
            page: true
            , done: function () {
                form.render();
                window.methods()
            }
        });

        window.methods = function() {
            // 发货
            $('.postExpress').off().on("click", function() {

                layer.open({
                    type: 1,
                    area: ['420px', '250px'], //宽高
                    content: `
                        <form class="layui-form" style="padding: 20px; padding-right: 40px">
                            <div class="layui-form-item">
                                <label class="layui-form-label">物流公司：</label>
                                <div class="layui-input-block">
                                <input type="text" name="logisticsName" lay-verify="required" autocomplete="off" lay-reqtext="物流单号必填项" placeholder="请输入物流公司" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">物流单号：</label>
                                <div class="layui-input-block">
                                <input type="text" name="deliveryOrdersNo" lay-verify="required" lay-reqtext="物流单号必填项" placeholder="请输入单号" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                                </div>
                            </div>
                        </form>
                    `
                });

                form.render();
                let _this = this;
                form.on("submit(demo1)", function(e) {
                    let data = JSON.parse($(_this).attr("data-item"));
                    e.field.ordersNo = data.ordersNo;
                    e.field.type = 1;
                    e.field.returnAddress = ""
                    ajax({
                        path: "/order/createOrUpdateOrdersLogistics",
                        type:"post",
                        data: e.field,
                        success: function (res) {
                            layer.closeAll();
                            layer.msg("发货成功！")
                            table.reload("orderListTable")
                        }
                    }, $)
                    return false;
                })
            })

            $('.closeOrder').off().on("click", function() {
                let data = JSON.parse($(this).attr("data-item"));
                ajax({
                    path: "/order/cancelOrder?ordersNo=" + data.ordersNo,
                    type:"get",
                    success: function (res) {
                        layer.closeAll();
                        layer.msg("取消成功")
                        table.reload("orderListTable")
                    }
                }, $)
            })

            $('.okTT').off().on("click", function() {
                let data = JSON.parse($(this).attr("data-item"));
                ajax({
                    path: "/order/reviewOrderReturn?ordersNo=" + data.ordersNo,
                    type:"get",
                    success: function (res) {
                        layer.closeAll();
                        layer.msg("退货成功")
                        table.reload("orderListTable")
                    }
                }, $)
            })

            $('.okTk').off().on("click", function() {
                let data = JSON.parse($(this).attr("data-item"));
                ajax({
                    path: "/order/reviewOrderRefunds?ordersNo=" + data.ordersNo,
                    type:"get",
                    success: function (res) {
                        layer.closeAll();
                        layer.msg("退款成功")
                        table.reload("orderListTable")
                    }
                }, $)
            })
        }

        laydate.render({
            elem: '#test1'
            ,range: true
        });

        // 搜索
        form.on("submit(searchForm)", function (e) {
            

            for (let key in e.field) {
                if (!e.field[key]) {
                    delete e.field[key]
                }
            }
            
            if (e.field.sDate) {
                var a = e.field.sDate.split(" - ")
                e.field.sDate = new Date(a[0]).format("yyyy-MM-dd hh:mm:ss");
                e.field.eDate = new Date(a[1]).format("yyyy-MM-dd hh:mm:ss");
            }

            table.reload('orderListTable', {
                page: {
                    start: 1 //重新从第 1 页开始
                }
                , where: e.field
            });

            return false;
        })


        // 搜索
        form.on("submit(reset)", function (e) {

            table.reload('orderListTable', {
                page: {
                    start: 1 //重新从第 1 页开始
                }
                , where: null
            });

            form.val("resets", {
                ordersNo: "",
                sDate: "",
                receiverName: "",
                receiverMobile: "",
                goodsName: ""
            });

            return false;
        })


        // 筛选状态
        form.on("select(select)", function (e) {

            table.reload('orderListTable', {
                page: {
                    start: 1 //重新从第 1 页开始
                }
                , where: {
                    ordersState: e.value
                }
            });
            var abc = "";
            switch (e.vlaue) {
                case 20000:
                    abc = "未付款";
                    break;
                case 20001:
                    abc = "已付款";
                    break;
                case 20002:
                    abc = "已发货";
                    break;
                case 20003:
                    abc = "确认收货";
                    break;
                case 20004:
                    abc = "交易关闭";
                    break;
                case 20007:
                    abc = "订单异常";
                    break;
                case 20005:
                    abc = "申请退款";
                    break;
                case 20006:
                    abc = "退款成功";
                    break;
                case 20007:
                    abc = "申请退货";
                    break;
                case 20008:
                    abc = "退货成功";
                    break;
            }
            $("#status .layui-select-title input").attr("placeholder", abc)
        })


        // 弹窗
        function layerOpen(data) {
            let methods = "";
            switch (data.payWay) {
                case 1:
                    methods = "微信支付";
                    break;
                case 2:
                    methods = "积分支付";
                    break;
                case 3:
                    methods = "扫码支付";
                    break;
                case 4:
                    methods = "微信+积分支付";
                    break;
                case 5:
                    methods = "扫码+积分支付";
                    break;
                case 10:
                    methods = "收益支付";
                    break;
                default:
                    methods = "-";
                    break;
            }

            let doms = "";
            for (let item = 0; item < data.orderDetailList.length; item++) {
                let el = data.orderDetailList[item];
                doms += `
                        <tr>
                            <td width="40%">
                                <img style="width:70px; height:70px;" src="${el.skuCoversUrl}" />
                                ${el.goodsName}    
                            </td>
                            <!-- ${el.skuTitleType}: -->
                            <td width="30%">${el.skuTitle}</td>
                            <td width="15%">￥${el.skuCurrPrice}</td>
                            <td width="15%">${el.quantity}</td>
                        </tr>
                `
            }


            // 步骤条
            var flagTitle = "等待买家付款", flagDesc = "等待买家完成付款，可主动与买家协调价格", elements = '';
            let stepData = [
                { title: "买家下单", description: data.createTime, status: 1 },
                { title: "买家付款", description: "" },
                { title: "商户发货", description: "" },
                { title: "交易完成", description: "" }
            ];

            delete data.orderDetailList;
            switch (data.ordersState) {
                case "20000":
                    elements = `<button type="button" class="layui-btn layui-btn-xs closeOrder" data-item='${JSON.stringify(data)}'>关闭订单</button>`
                    break;
                case "20001":
                    stepData[1].status = 1;
                    flagTitle="等待商户发货"
                    flagDesc="请尽快处理发货，若无法发货请及时联系退款"
                    elements = '<button type="button" class="layui-btn layui-btn-sm postExpress" data-item="'+ JSON.stringify(data) +'">发货</button>'
                    break;
                case "20002":
                    stepData[1].status = 1;
                    stepData[2].status = 1;
                    flagTitle="商户部分发货"
                    flagDesc="请尽快完成全部商品发货，若无法发货请及时联系退款"
                    break;
                case "20003":
                    stepData[1].status = 1;
                    stepData[2].status = 1;
                    stepData[3].status = 1;
                    flagTitle="买家已确认到货"
                    flagDesc="该笔订单已完成交易"
                    break;
                case "20004":
                    stepData[1].title = "订单取消"
                    stepData[1].status = 1;
                    flagTitle="订单已关闭"
                    flagDesc="订单已被用户/商户取消"
                    
                    break;
                case "20005":
                    stepData = [
                        { title: "买家申请退款", description: data.createTime, status: 1 },
                        { title: "退款完成", description: "" }
                    ];
                    flagTitle="等待处理退款申请"
                    flagDesc="请尽快处理退款"
                    elements = `<button type="button" class="layui-btn layui-btn-sm okTk" data-item='${JSON.stringify(data)}'>同意退款</button>`
                    break;
                case "20006":
                    stepData = [
                        { title: "买家申请退款", description: data.createTime, status: 1 },
                        { title: "退款完成", description: data.refundTime, status: 1 }
                    ];
                    flagTitle="商户完成退款"
                    flagDesc="商户完成退款"
                    break;
                case "20007":
                    stepData = [
                        { title: "买家申请退货", description: data.createTime, status: 1 },
                        { title: "退款完成", description: "", status: 0 }
                    ];
                    flagTitle="等待买家退货给商家"
                    flagDesc="等待买家退货给商家"
                    elements = `<button type="button" class="layui-btn layui-btn-sm okTT" data-item='${JSON.stringify(data)}'>同意退货</button>`
                    break;
                case "20008":
                    stepData = [
                        { title: "买家申请退货", description: data.createTime, status: 1 },
                        { title: "退货完成", description: data.returnTime, status: 1 }
                    ];
                    flagTitle="退货完成"
                    flagDesc="退货已完成"
                    break;
            }


            layer.open({
                type: 1,
                title: "订单详情",
                area: ['960px', '660px'], //宽高
                content: `
                    <div class="layer-container">
                        <p style="color:#666; margin-bottom: 10px;">订单编号：${data.ordersNo}  &nbsp;&nbsp; 下单时间：${data.createTime} &nbsp;&nbsp; ${data.special ? "特殊商品" : data.vipOrder?"VIP商品":"普通商品"}  ${data.integralOrder ? " <span style='margin-left: 10px'>积分商品订单</span>" : ""}</p>
                        <ul>
                            <li class="flag">
                                <h1>${flagTitle}</h1>
                                <p>${flagDesc}</p> 
                                <p>
                                    ${elements}
                                </p>
                            </li>

                            <li id="steps13"></li>
                        </ul>
                        <ul style="margin-top:20px">
                            <li style="text-align:left">
                                <p style="font-size:18px; font-weight:bold;">收货信息</p>
                                <p>收货人：${data.receiverName}</p> 
                                <p>联系电话：${data.receiverMobile}</p> 
                                <p>收货地址：${data.receiverDistrict}${data.receiverAddress}</p> 
                            </li>
                            <li style="text-align:left">
                                <p style="font-size:18px; font-weight:bold;">付款信息</p>
                                ${
                                    data.ordersState == "20000" || data.ordersState == "20004"?
                                    
                                    `<p>待付金额：¥${data.finalAmount || 0}</p>`
                                    :
                                    `<p>已付金额：¥${data.finalAmount || 0}</p>`
                                    
                                }
                                <p>付款方式：${methods}</p>
                                <p>优惠金額：¥${data.preferentialAmount}</p>
                            </li>
                            <li style="text-align:left">
                                <p style="font-size:18px; font-weight:bold;">配送信息</p>
                                <p>配送方式：物流快递</p> 
                                <p>单号：<span id="mh">-</span></p> 
                                <p>快递公司：<span id="ms">-</span></p> 
                            </li>
                            ${
                                data.ordersState == "20007" || data.ordersState == "20008" ?
                                `<li style="text-align:left">
                                    <p style="font-size:18px; font-weight:bold;">退货信息</p>
                                    <p>退款金额：￥${data.vipOrder == 1?'-':(data.finalAmount?data.finalAmount:'0')}</p>
                                    <p>退款积分：${data.refundIntegral ? data.refundIntegral : '-'}</p>
                                    <p>配送方式：物流快递</p>
                                    <p>退货单号：<span id="h"></span></p> 
                                    <p>快递公司：<span id="s"></span</p> 
                                </li>`
                                :
                                ""
                            }
                            
                        </ul>
                        ${
                            data.ordersState == "20007" || data.ordersState == "20008" ? 
                                `<ul>
                                    <li style="text-align:left; color: #666">
                                        <div>退货原因：${data.returnDes ? data.returnDes:"-"}</div>
                                        <div>退货时间：${data.returnTime ? data.returnTime:"-"}</div>
                                        <div>退货凭证：
                                            <div class="viewImg"></div>
                                        </div>
                                    </li>
                                </ul>`
                            :
                            ""
                        } 
                        ${
                            data.ordersState == "20005" || data.ordersState == "20006" ? 
                                `<ul>
                                    <li style="text-align:left; color: #666">
                                       <div>退款原因：${data.refundDes}</div>
                                        <div>退款时间：${data.refundTime}</div>
                                        <div>退款凭证：
                                            <div class="viewImg"></div>
                                        </div>
                                    </li>
                                </ul>`
                            :
                            ""
                        } 
                        <ul style="margin-top:20px">
                            <table class="layui-table">
                                <colgroup>
                                    <col width="150">
                                    <col width="150">
                                    <col width="200">
                                    <col>
                                </colgroup>
                                <thead>
                                    <tr>
                                        <th>商品</th>
                                        <th>规格</th>
                                        <th>价格</th>
                                        <th>数量</th>
                                    </tr> 
                                </thead>
                                <tbody>
                                    ${doms}
                                </tbody>
                            </table>
                        </ul>
                        
                    </div> `,
                success: function () {

                    // 放大图片
                    $(".viewImg").on("click", function() {
                        let url = $(".viewImg img").attr("src");
                        layer.open({
                            type: 1,
                            title: false,
                            closeBtn: 0,
                            area: ['auto'],
                            skin: 'layui-layer-nobg', //没有背景色
                            shadeClose: true,
                            content: "<img src=" + url + " />"
                        });
                    })

                    if (data.returnImg) {
                        data.returnImg.split(",").forEach(el => {
                            $(".viewImg").append(`
                                <img style="width:80px; height:80px; margin: 5px; border:1px solid #ccc; padding:5px;" src="${el}"/>
                            `)
                        })
                    }

                    if (data.refundImg) {
                        data.refundImg.split(",").forEach(el => {
                            $(".viewImg").append(`
                                <img style="width:80px; height:80px; margin: 5px; border:1px solid #ccc; padding:5px;" src="${el}"/>
                            `)
                        })
                    }
                    
                    var steps13 = steps({
                        el: "#steps13",
                        data: stepData,
                        center: true,
                        active: 1,
                        iconType: "bullets"
                    });

                    window.methods();

                    // 退货快递
                    ajax({
                        path: "/order/getOrdersLogisticsList?type=2&ordersNo=" + data.ordersNo,
                        type:"get",
                        success: function (res) {
                            if (res[0] && res[0].deliveryOrdersNo) {
                                $("#h").html(res[0].deliveryOrdersNo);
                            }

                            if (res[0] && res[0].logisticsName) {
                                $("#s").html(res[0].logisticsName);
                            }
                        }
                    }, $)

                    // 购买快递
                    ajax({
                        path: "/order/getOrdersLogisticsList?type=1&ordersNo=" + data.ordersNo,
                        type:"get",
                        success: function (res) {
                            if (res.length) {
                                if (res[0] && res[0].deliveryOrdersNo) {
                                    $("#mh").html(res[0].deliveryOrdersNo);
                                }
                                if (res[0] && res[0].logisticsName) {
                                    $("#ms").html(res[0].logisticsName);
                                }
                                
                            }
                            
                        }
                    }, $)
                }
            });

        }


        // 编辑和删除
        table.on("tool(orderListTable)", function (data) {
            console.log(data.data);
            switch (data.event) {
                case "lookDetails":
                    layerOpen(data.data);
                    break;
            }
        })
    });
</script>

</html>